<!DOCTYPE html>
<html class="um landscape min-width-240px min-width-320px min-width-480px min-width-768px min-width-1024px">
    <head>
        <title></title>
        <meta charset="utf-8">
        <meta name="viewport" content="target-densitydpi=device-dpi, width=device-width, initial-scale=1, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
        <link rel="stylesheet" href="css/ui-input_ac.css">
        <link rel="stylesheet" href="css/ui-img_ac.css">
        <link rel="stylesheet" href="css/ui-base_ac.css">
        <link rel="stylesheet" href="css/ui-box_ac.css">
        <link rel="stylesheet" href="css/ui-color_ac.css">
		<link rel="stylesheet" href="css/ensureNode.css">
		<link rel="stylesheet" href="css/project/style.css">
		
        <script src="js/zy_control.js"></script>
        <script src="js/zy_click.js"></script>
        <script src="js/zy_json.js"></script>
        <script src="js/base64.js"></script>
        <script src="js/main.js"></script>
		<script src="js/accountsQuery.js"></script>
		<script src="js/talkingdata.js"></script>
        <style>
            .bcImage {
                background-image: url(images/bcImage.png);
                background-size: 100% 100%;
            }
            .return {
                background-image: url('images/delaySchedule1.png');
                height: 1em;
                width: 1em;
            }
            .calendar {
                background-image: url('images/calendar.png');
                height: 1em;
                width: 1em;
            }
            .down {
                background-image: url('images/down-angle.png');
                width: 1em;
                height: 1em;
            }
            .tx-col {
                color: #36395c;
            }
            .bc_wh {
                background-color: white;
            }
            .wid1 {
                width: 100%;
            }
            .bor_t {
                border: 1px solid #669ab3;
            }
            .bor_s {
                border: 1px solid #4088ab;
                background-color: #0099ff;
                width: 1.6em;
                height: 1.5em;
            }
            .bor_b {
                border: 1px solid rgba(255,255,255);
                border-radius: .2em;
                padding: .75em;
                width: 5.5em;
            }
            .padd {
                padding: .1em;
            }
            .inp {
                width: 100%;
                height: 100%;
                border: 0px;
                font-size: 1em;
                padding: .15em;
            }
			
			/***new add****/
			.totaltxt{
				color:#3D3D3D;
			}
			
        </style>

    </head>
    <body class="um-vp " ontouchstart>
        <div id="page_0" class="up ub ub-ver bc-bg" tabindex="0">
        	 <!--header开始-->
            <div id="header" class="uh ub t-wh" style="background-color: #36395c">
                <div class="nav-btn" id="nav-left" onclick="winClose('-1')">
                    <div class="return ub-img"></div>
                </div>
                <h1 class="ut ub-f1 ulev0 ut-s tx-c " tabindex="0">外站应收应付查询</h1>
                <div class="nav-btn nav-bt" id="nav-right"></div>
            </div>
            <!--header结束-->
          <!--content开始-->
            <div id="content" class="ub-f1 tx-l uinn ub-img bcImage">
                <!--总费用表格-->
				<div id="totalCost" class="totaltxt"></div>	
				<!-- 按钮选项卡 --> 
				<div id="tabControl" class="tabControl equal"></div>	
				<!--详情表格固定表头-->
				<div id="tabletitle" class="uhide">
					<table class="tb">
						<tr>
							<th class="titleth ulev-3">航班日期</th>
							<th class="titleth ulev-3">航线名称</th>
							<th class="titleth ulev-3">航班号</th>
							<th class="titleth ulev-3">计付</th>
							<th class="titleth ulev-3">实配</th>
							<th class="titleth ulev-3">实收</th>
						 </tr>
					</table>
				</div>
				<!--详情表格-->
				<div id="detailstable"  style="overflow:auto;" onscroll="loadNewDetail(this.clientHeight,this.scrollHeight,this.scrollTop)">
					<table  id="details" class="tb">
					</table>
				</div>
            </div>
            <!--content结束-->
			
        </div>
	 <div id="diyLoadDiv" class="uhide" ></div>
    </body>
    <script>
zy_init();
//var type='GetASAPSummary';
var page=1;
var PageSize=30;
var timeslot='';
var carrier='';
var fjgs='';
var csgs='';
var hb='';

var interval;

var type_t='';
var type_s='';

var  timekeeper=0;//计时 若load超过1分半钟 提示超时
window.uexOnload = function(type) {
            if (!type) {
//				 loadingStart("加载中...", 0);
           		IC.talkingDataCount("外站应收应付费用","0024");
				
				timeslot=getStorage("FLIGHTDATE");
//				alert(timeslot);
				var arr=timeslot.split("-");
				var y=arr[0];
				var m=arr[1];
				m=m.length>2?m.substr(1,2):m;
				var d=arr[2];
				d=d.length>2?d.substr(1,2):d;
				carrier=getStorage("carrier");
				fjgs=getStorage("aircraftCompanyId");
				csgs=getStorage("mealCompanyId");
				hb=getStorage("hb");
				
				var isOneDayData=getStorage("isOneDayData");
				if(isOneDayData=='true')  //只显示一天的数据
				{
					timeslot=y+"-"+m+"-"+d;
					type_t="GetASAPTotalOneDay";
					type_s="GetASAPSummaryOneDay";
//					requestData("GetASAPTotalOneDay","GetASAPSummaryOneDay")
				}else
				{
					type_t="GetASAPTotal";
					type_s="GetASAPSummary";
					timeslot=y+m;
//					requestData("GetASAPTotal","GetASAPSummary")
				}
				
				requestData();
            }
}
/**
 * 
 * @param {Object} type_t : GetASAPTotal or GetASAPTotalOneDay 
 * @param {Object} type_s: GetASAPSummary  or  GetASAPSummaryOneDay  
 */
function requestData()
{
	IC.talkingDataCount("外站应收应付费用","0024");
//	alert("requestData: "+page)
	Loading(0);
	if(page==1)  //只有一开始才请求总费用表
	{
		var totaldata =[{'key':'type','type':'0','value':type_t} ,{'key':'timeslot','type':'0','value':timeslot}, {'key':'carrier','type':'0','value':carrier}, {'key':'fjgs','type':'0','value':fjgs}, {'key':'csgs','type':'0','value':csgs},{'key':'hb','type':'0','value':''}];
		dataRequest(totaldata,type_t);    //总费用表
	}
	
	var summarydata =[{'key':'type','type':'0','value':type_s} , {'key':'page','type':'0','value':page} ,{'key':'PageSize','type':'0','value':PageSize},{'key':'timeslot','type':'0','value':timeslot},{'key':'carrier','type':'0','value':carrier}, {'key':'fjgs','type':'0','value':fjgs}, {'key':'csgs','type':'0','value':csgs},{'key':'hb','type':'0','value':''}];
	
	dataRequest(summarydata,type_s); //详细费用一览表
	
	 interval=setInterval("drawHtml()",2000);  
	
}


function drawHtml()
{
	timekeeper+=2;
	if(timekeeper>90)
	{
		Loading(-1);
		clearInterval(interval);
		timekeeper=0;
		$alert("服务器无响应！"); 
		return;
	}
	
	if(json_GetASAPTotal!=null&&json_GetASAPSummary!=null)
	{
		timekeeper=0;
		Loading(-1);
		clearInterval(interval);
		if(page==1)
		{
			getTotalHtml(json_GetASAPTotal.info[0].rows[0]);//获取summaryHtml
			$$("totalCost").innerHTML = totalHtml;
			var tabHtml=getTabControlHtml();
			
			$$("tabControl").innerHTML = tabHtml;
			
			$$("tabletitle").className='';
			summaryHtml(json_GetASAPSummary.info[0].rows);
			var h=$$("header").offsetHeight;
			var h1=$$("totalCost").offsetHeight;
			var h2=$$("tabControl").offsetHeight;
			var h3=$$("tabletitle").offsetHeight;
			var bodyH = document.body.clientHeight;
			$$("detailstable").style.height=(bodyH-h1-h2-h3-h*2)+"px";
			tabCheck(0);
		}else{
			summaryHtml(json_GetASAPSummary.info[0].rows);
			tabCheck(parseInt(getStorage("tabnum")));
		}
	}
}

function loadNewDetail(h,sh,st)
{
	if(h+st>=sh-5)
	{
		json_GetASAPSummary=null;
		page++;
		requestData();
	}
}


    </script>
</html>